package com.github.thinwonton.spring.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.github.thinwonton.spring.exception.AuthException;

/**
 * @author hugo
 *
 */
@Controller
public class ExceptionController {

	/**
	 * 返回AuthException异常，返回authExceptionView.jsp
	 * 
	 * @return
	 */
	@RequestMapping(value = "/employee")
	public String getEmployeeList() {
		throw new AuthException("Unauthorized");
	}

	/**
	 * 抛出NullPointerException异常，返回defaultErrorView.jsp
	 * 
	 * @return
	 */
	@RequestMapping(value = "/employee/{id}")
	public String getEmployeeById(@PathVariable(value = "id") Long id) {
		throw new NullPointerException();
	}
}
